package net.dfrz.lightshare.login.service;

import net.dfrz.lightshare.login.dao.LoginDaoImpl;
import net.dfrz.lightshare.user.model.User;

public class LoginServiceImpl implements ILoginService {

	private LoginDaoImpl ld;
	private User u;
	@Override
	public String checkLogin(User user) {
		ld = new LoginDaoImpl();
		u = new User();
		u = ld.getUserByEmail(user.getEmail());
		if(u!=null){
			if(user.getEmail().equals(u.getEmail())){
				u = ld.getUserByEmailAndPassword(user);
			}
		}
		else{
			return "MULL";
		}
		if(u!=null){
			return "SUCCESS";
		}
		return "NULL";
	}
//	public static void main(String[] args) {
//		
//		User u = new User();
//		u.setEmail("453@qq.com");
//		u.setPassword("123");
//		LoginServiceImpl l = new LoginServiceImpl();
//		l.checkLogin(u);
//	}
}
